import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes: RouteConfig[] = [
  {
    path: '/',
    component: () => import('../views/Main.vue'),
    children: [
      { name: 'home', path: '/', component: () => import('../views/Home.vue') },
      {
        name: 'courses-list',
        path: '/courses/list',
        component: () => import('../views/courses/courseList.vue')
      },
      {
        name: 'courses-edit',
        path: '/courses/edit/:id',
        component: () => import('../views/courses/courseEdit.vue'),
        props: true
      },
      {
        name: 'courses-create',
        path: '/courses/create',
        component: () => import('../views/courses/courseEdit.vue')
      },
      {
        name: 'episodes-list',
        path: '/episodes/list',
        component: () => import('../views/episodes/episodeList.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
